<template>
  <div>
    <monaco-editor ref="modifyEditor" language="xml" :code="content"/>
  </div>
</template>

<script>
const defaultPomContent = '<?xml version="1.0" encoding="UTF-8"?>\n' +
  '<project xmlns="http://maven.apache.org/POM/4.0.0"\n' +
  '         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n' +
  '         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\n' +
  '    <modelVersion>4.0.0</modelVersion>\n' +
  '\n' +
  '    <groupId>org.example</groupId>\n' +
  '    <artifactId>example</artifactId>\n' +
  '    <version>1.0-SNAPSHOT</version>\n' +
  '\n' +
  '    <dependencies>\n' +
  '        \n' +
  '    </dependencies>\n' +
  '\n' +
  '</project>'

import MonacoEditor from '@/views/components/MonacoEditor'

export default {
  name: 'PomEdit',
  components: { MonacoEditor },
  data(){
    return {
      content: null
    }
  },
  methods: {
    getValue(){
      return this.$refs.modifyEditor.getValue()
    },
    setValue(value){
      this.$refs.modifyEditor.setValue(value)
    }
  },
  mounted() {
    if (this.content == null){
      this.content = defaultPomContent
    }
  }
}
</script>

<style scoped>

</style>
